from rest_framework import serializers
from .models import Book


class BookSerializer(serializers.ModelSerializer):
    class Meta:
        model = Book
        fields = "__all__"  # 所有字段都返回，如果只需要部分字段，可以指定 fields = ('id', 'title', 'author')
